package com.atguigu.tingshu.order.client;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.order.OrderInfo;
import com.atguigu.tingshu.order.client.impl.OrderDegradeFeignClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * <p>
 * 订单模块远程调用API接口
 * </p>
 *
 * @author atguigu
 */
@FeignClient(
        value = "service-order",
        contextId = "orderFeignClient",
        fallback = OrderDegradeFeignClient.class,
        path = "api/order"
)
public interface OrderFeignClient {

    /**
     * 根据订单号获取订单相关信息
     *
     * @param orderNo 订单号
     * @return 订单信息
     */
    @GetMapping("/orderInfo/getOrderInfo/{orderNo}")
    Result<OrderInfo> getOrderInfo(@PathVariable String orderNo);


    /**
     * 在支付成功后更新订单
     * @param orderNo 订单号
     */
    @GetMapping("/orderInfo/updateOrderOnPaySuccess/{orderNo}")
    Result<Void> updateOrderOnPaySuccess(@PathVariable String orderNo);
}
